package com.hxkj.controller.article;


import com.hxkj.domain.po.LabelTags;
import com.hxkj.service.article.LabelManagementService;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultMessageStruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.concurrent.Callable;

/**
 * 标签管理
 * <p>
 * Created by yaosy on 2018年7月20日17:01:42
 */
@RestController
@RequestMapping("/labelManagement")
public class LabelManagementController {


    @Autowired
    private LabelManagementService labelManagementService;


    /**
     * 保存
     *
     * @param labelTags
     * @throws Exception
     */
    @RequestMapping(value = "/save")
    public void save(@ModelAttribute LabelTags labelTags) throws Exception {
        labelManagementService.save(labelTags);
    }


    /**
     * 获取单条数据
     *
     * @param labelTags
     * @throws Exception
     */
    @RequestMapping(value = "/get")
    public Callable<ResultDataStruct<LabelTags>> get(@ModelAttribute LabelTags labelTags) throws Exception {
        return ()-> labelManagementService.get(labelTags);
    }

    /**
     * 列表
     * @param labelTags
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getLabelTags")
    public Callable<List<LabelTags>> getLabelTags(@ModelAttribute LabelTags labelTags) throws Exception {
        return ()-> labelManagementService.getLabelTags(labelTags);
    }


    /**
     * 修改
     * @param labelTags
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/modify")
    public Callable<ResultMessageStruct> modify(@ModelAttribute LabelTags labelTags) throws Exception {
        return ()-> labelManagementService.modify(labelTags);
    }


    /**
     * 删除
     * @param labelTags
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/remove")
    public void remove(@ModelAttribute LabelTags labelTags) throws Exception {
        labelManagementService.remove(labelTags);
    }

}
